<?php
 class Admin_Model_Login extends Zend_Db_Table_Abstract{
 	protected $_name = "users";
	protected $_primary = "id";
	
	public function salt($email){
		$salt = $this->select();
			$salt->from('users','salt');
			$salt->where('email = ?', $email);
			$salt = $this->fetchAll($salt);
			return $salt->toArray();
	}
	
	public function check_login($email,$password){
		$salt= $this->salt($email);
		$data = $this->select();
			$data->from('users');
			$data->where('email = ?', $email);
			$data->where('password = ?', md5(md5($password).$salt[0]['salt']));
			$data->where('is_delete = ?',0);
			$data=$this->fetchAll($data);
			return $data;
	}
 }